<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
$intID = (int)$_data["ID"];
$arrGame = getGambleDataByID($intID);

if(!is_array($arrGame) || sizeof($arrGame) == 0){
	@mysql_close($$_Conn);
	header("Location: ".basename($_SERVER["PHP_SELF"])."?op=List");
	exit();
}

$strGD = DateForm($arrGame["GameDate"], $arrGame["GameTime"]);
$strGT = TimeForm($arrGame["GameDate"], $arrGame["GameTime"]);

$arrLotto = GetLottoData($arrGame["LottoID"]);
if(!$arrLotto)ErrMsgOutputHTML("Error", "", 1);

$strLotto = $arrLotto["Lotto_".$_intLang];

$fp = @file($strTemplatePath."Score.html");
$fp = implode("", $fp);
$fp = setHTMLCharset($fp);
$fp = str_replace("{LType}", $arrLotto["LType"], $fp);
$fp = str_replace("{ShowID}", $intID, $fp);
$fp = str_replace("{ShowLottoID}", $arrGame["LottoID"], $fp);
$fp = str_replace("{ShowLotto}", $strLotto, $fp);
$fp = str_replace("{ShowSerialNo}", $arrGame["SerialNo"], $fp);
$fp = str_replace("{ShowisEnd}", $arrGame["isEnd"], $fp);
$fp = str_replace("{ShowGameDate}", $arrGame["GameDate"], $fp);
$fp = str_replace("{ShowTime}", $strGD."&nbsp;".$strGT, $fp);

if($arrGame["isEnd"] == 1){
	$strScore = GetRelationType3 ("`bet_GambleScore`", " GambleID = ".$intID, " ID, CONCAT(NumberNormal, '#', NumberSpecial) as Value ");
	$arrNumber = explode("#", $strScore);
	$arrNormalNumber = explode(",", $arrNumber[0]);
	$fp = preg_replace("/<!-- @ GameEnd Sd @ \/\/-->.+<!-- @ GameEnd End @ \/\/-->/s", "", $fp);
}else{
	@include_once(__Common_Path."/ShowScore_".$arrGame["LottoID"].".inc.php");
	$arrNumber[1] = $_NumberSpecial;
	$arrNormalNumber = split(",", $_NumberNormal);
}

for($intNum = 0; $intNum < 7; $intNum++){
	$intScore = $arrNormalNumber[$intNum];
	$fp = str_replace("{ShowNNumber".$intNum."}", $intScore, $fp);
}
$fp = str_replace("{ShowSNumber}", $arrNumber[1], $fp);

switch($arrLotto["LType"]){
	case 4:
		$fp = preg_replace("/<!-- @ LType4 Sd @ \/\/-->.+<!-- @ LType4 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN4 Sd @ \/\/-->.+<!-- @ LTypeNN4 End @ \/\/-->/s", "", $fp);
	case 1:
		$fp = preg_replace("/<!-- @ LType2 Sd @ \/\/-->.+<!-- @ LType2 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LType3 Sd @ \/\/-->.+<!-- @ LType3 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN2 Sd @ \/\/-->.+<!-- @ LTypeNN2 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN3 Sd @ \/\/-->.+<!-- @ LTypeNN3 End @ \/\/-->/s", "", $fp);
		break;

	case 2:
		$fp = preg_replace("/<!-- @ LType1 Sd @ \/\/-->.+<!-- @ LType1 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LType3 Sd @ \/\/-->.+<!-- @ LType3 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN1 Sd @ \/\/-->.+<!-- @ LTypeNN1 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN3 Sd @ \/\/-->.+<!-- @ LTypeNN3 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeSN Sd @ \/\/-->.+<!-- @ LTypeSN End @ \/\/-->/s", "", $fp);
		if(!($arrGame["LottoID"] == 7 || $arrGame["LottoID"] == 8)){
			$fp = preg_replace("/<!-- @ LType2-1 Sd @ \/\/-->.+<!-- @ LType2-1 End @ \/\/-->/s", "", $fp);
			$fp = preg_replace("/<!-- @ LTypeNN2-1 Sd @ \/\/-->.+<!-- @ LTypeNN2-1 End @ \/\/-->/s", "", $fp);
		}
		break;

	case 3:
		$fp = preg_replace("/<!-- @ LType1 Sd @ \/\/-->.+<!-- @ LType1 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LType2 Sd @ \/\/-->.+<!-- @ LType2 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN1 Sd @ \/\/-->.+<!-- @ LTypeNN1 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeNN2 Sd @ \/\/-->.+<!-- @ LTypeNN2 End @ \/\/-->/s", "", $fp);
		$fp = preg_replace("/<!-- @ LTypeSN Sd @ \/\/-->.+<!-- @ LTypeSN End @ \/\/-->/s", "", $fp);
		break;
}

while(list($k, $v) = each($_strCompetition)){
	$fp = str_replace("{".$k."}", $v, $fp);
}

//輸出
WebOutputHTML($fp, 1);
?>